home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / xvisrc.zip / PARAM.H < prev    next >
C/C++ Source or Header  |  1992-07-28  |  4KB  |  173 lines

  1. /* Copyright (c) 1990,1991,1992 Chris and John Downey */
  2. /***
  3.  
  4. * @(#)param.h    2.1 (Chris & John Downey) 7/29/92
  5.  
  6. * program name:
  7.     xvi
  8. * function:
  9.     PD version of UNIX "vi" editor, with extensions.
  10. * module name:
  11.     param.h
  12. * module function:
  13.     Definitions for parameter access.
  14.  
  15.     This is all going to change when we have local parameters.
  16. * history:
  17.     STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  18.     Originally by Tim Thompson (twitch!tjt)
  19.     Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  20.     Heavily modified by Chris & John Downey
  21.  
  22. ***/
  23.  
  24. /*
  25.  * Settable parameters.
  26.  */
  27.  
  28. typedef union {
  29.     int        pv_i;
  30.     bool_t    pv_b;
  31.     char    *pv_s;
  32.     char    **pv_l;
  33. } Paramval;
  34.  
  35. typedef    struct    param {
  36.     char    *p_fullname;    /* full parameter name */
  37.     char    *p_shortname;    /* permissible abbreviation */
  38.     int        p_flags;    /* type of parameter, and whether implemented */
  39.  
  40.     /*
  41.      * This field is used for numeric and boolean values,
  42.      * and for storing the numeric representation for enums.
  43.      */
  44.     int        p_value;
  45.  
  46.     /*
  47.      * Special function to set parameter.
  48.      * This is called whenever the parameter is set by the user.
  49.      */
  50.     bool_t    (*p_func) P((Xviwin *, Paramval, bool_t));
  51.  
  52.     /*
  53.      * This field is used for strings, lists and enums.
  54.      * Note that making this the last field allows us to initialise the
  55.      * parameter table, since we can just leave this field uninitialised.
  56.      */
  57.     union {
  58.     char    *pu_str;
  59.     char    **pu_list;
  60.     } pu;
  61. } Param;
  62.  
  63. #define    p_num    p_value
  64. #define    p_bool    p_value
  65. #define    p_eval    p_value
  66.  
  67. #define    p_str    pu.pu_str
  68. #define    p_list    pu.pu_list
  69. #define    p_elist    pu.pu_list
  70.  
  71. #ifdef __ZTC__
  72. #   define    PFUNCADDR(f)    ((bool_t (*)(Xviwin *, Paramval, bool_t))(f))
  73. #else
  74. #   define    PFUNCADDR(f)    (f)
  75. #endif
  76.  
  77. extern    Param    params[];
  78.  
  79. /*
  80.  * Flags
  81.  */
  82. #define    P_BOOL        0x01    /* the parameter is boolean */
  83. #define    P_NUM        0x02    /* the parameter is numeric */
  84. #define    P_STRING    0x04    /* the parameter is a string */
  85. #define    P_ENUM        0x08    /* the parameter is an enumerated type */
  86. #define    P_LIST        0x20    /* the parameter is a list of strings */
  87.  
  88. #define    P_TYPE        0x2f    /* used to mask out type from other bits */
  89.  
  90. #define    P_CHANGED    0x10    /* the parameter has been changed */
  91.  
  92. /*
  93.  * Macros to set/get the value of a parameter.
  94.  * One each for the four parameter types.
  95.  * May change implementation later to do more checking.
  96.  */
  97. #define    Pn(n)        (params[n].p_num)
  98. #define    Pb(n)        (params[n].p_bool)
  99. #define    Ps(n)        (params[n].p_str)
  100. #define    Pl(n)        (params[n].p_list)
  101. #define    Pen(n)        (params[n].p_value)
  102. #define    Pes(n)        (params[n].p_elist[params[n].p_eval])
  103.  
  104. #define P_ischanged(n)    (params[n].p_flags & P_CHANGED)
  105. #define P_setchanged(n)    (params[n].p_flags |= P_CHANGED)
  106.  
  107. /*
  108.  * The following are the indices in the params array for each parameter.
  109.  * They must not be changed without also changing the table in "param.c".
  110.  */
  111. #define P_ada        0
  112. #define P_adapath     1
  113. #define P_autoindent     2
  114. #define P_autoprint     3
  115. #define P_autosplit     4
  116. #define P_autowrite     5
  117. #define P_beautify     6
  118. #define P_cchars     7
  119. #define P_colour     8
  120. #define P_directory     9
  121. #define P_edcompatible     10
  122. #define P_edit         11
  123. #define P_errorbells     12
  124. #define P_format     13
  125. #define P_hardtabs     14
  126. #define P_helpfile     15
  127. #define P_ignorecase     16
  128. #define P_jumpscroll     17
  129. #define P_lisp         18
  130. #define P_list         19
  131. #define P_magic     20
  132. #define P_mchars     21
  133. #define P_mesg         22
  134. #define P_minrows     23
  135. #define P_modeline     24
  136. #define P_number     25
  137. #define P_open         26
  138. #define P_optimize     27
  139. #define P_paragraphs     28
  140. #define P_preserve     29
  141. #define P_preservetime     30
  142. #define P_prompt     31
  143. #define P_readonly     32
  144. #define P_redraw     33
  145. #define P_regextype     34
  146. #define P_remap     35
  147. #define P_report     36
  148. #define P_roscolour     37
  149. #define P_scroll     38
  150. #define P_sections     39
  151. #define P_sentences     40
  152. #define P_shell     41
  153. #define P_shiftwidth     42
  154. #define P_showmatch     43
  155. #define P_slowopen     44
  156. #define P_sourceany     45
  157. #define P_statuscolour     46
  158. #define P_systemcolour     47
  159. #define P_tabs         48
  160. #define P_tabstop     49
  161. #define P_taglength     50
  162. #define P_tags         51
  163. #define P_term         52
  164. #define P_terse     53
  165. #define P_timeout     54
  166. #define P_ttytype     55
  167. #define P_vbell     56
  168. #define P_warn         57
  169. #define P_window     58
  170. #define P_wrapmargin     59
  171. #define P_wrapscan     60
  172. #define P_writeany     61
  173.